package com.example.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.example.model.BeerExpert;

/**
 * Servlet implementation class BeerSelect
 */
public class BeerSelect extends HttpServlet { 
	private static final long serialVersionUID = 1L;
       
   
    public BeerSelect() {
        super();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	}

	@SuppressWarnings("unchecked")
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		//response.setContentType("text/html");
		//PrintWriter out= response.getWriter();
		//out.print("Beer Selectio Advicer <br>");
		//out.print("<br> Got beer color: " + c);
		
		
		String c=request.getParameter("drink");
		BeerExpert be =new BeerExpert();
		
		List result= be.getBrands(c);
			
		request.setAttribute("style", result);
		RequestDispatcher view = request.getRequestDispatcher("result.jsp");
		view.forward(request, response);
		
		
	}

}
